#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
class Solution {
public:
    int firstUniqChar(string s) {
        int arr[26] = { 0 };
        for (size_t i = 0; i <= s.size() - 1; ++i)
        {
            ++arr[s[i] - 'a'];
        }
        for (size_t i = 0; i <= s.size() - 1; ++i)
        {
            if (arr[s[i] - 'a'] == 1)
            {
                return i;
            }
        }
        return -1;
    }
};